package com.woniuxy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.entity.ProductLine;



@Mapper
public interface ProductLineMapper {
	    //查询所有产品线
		@Select("select * from t_line1")
		public List<ProductLine> findAllProductLine();
		
		//新增一条产品线
		@Insert("insert into t_line1(lid,lname,status,sort,time,description) values(default,#{lname},#{status},#{sort},#{time},#{description})")
		public int addProductLine(ProductLine productLine);
		
		//根据状态查询产品线
		@Select("select * from t_line1 where status=#{status}")
		public List<ProductLine> findProductLineByStatus(int status);
		
		//模糊查询
		@Select("select * from t_line1 where lname like CONCAT('%',#{lname},'%')")
		public List<ProductLine> findProductLineByLname(String lname);
		
		//删除操作
		@Delete("delete from t_line1 where lid=#{lid}")
		public int delectProductLineByLid(int lid);
			
		//改switch状态
		@Update("update t_line1 set status=#{status} where lid=#{lid}")
		public int updateSwitch(ProductLine ProductLine);

}
